<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style/admin.css" />
<link rel="stylesheet" type="text/css" href="style/global.css" />
<title>无标题文档</title>
</head>

<body>
	<div id="wrap">
    	<div id="public_head"></div>
        <div class="m_search">
        <form method='post' action=''>
        <?php if(CSM_UNIT_ID>0){?>
        	<input class="btn_add" name="" type="button" value="" onclick="setback();document.location.href='/index.php?c=quest&a=add'" /> 
        <?php }?>
        	题库类别 <select class="select" id='all_cattype' name="ct">
        	<?php 
        		if(is_array($titCate) && count($titCate)>0){
        			echo "<option value='0'>所有分类</option>";
        			foreach ($titCate as $v){
        	?>
        		<option <?php if($v['CID']==$cattype){echo 'selected';}?> value="<?php echo $v['CID']?>"><?php echo $v['CN']?></option>
        	<?php }}else{
        		echo "<option value='0'>请添加题目分类</option>";
        	}?>
        	</select> 
        	题目属性 <select class="select" name="attr">
        		<option value='0' selected>所有题库</option>
        		<option value='1' <?php if($attr==1)echo 'selected';?>>用户题库</option>
        		<option value='2' <?php if($attr==2)echo 'selected';?>>系统题库</option>
        	</select> 
        	标题 <input class="qi_text" name="title" type="text" value="<?php echo $title;?>"/> 
        	<input class="btn_search" name="sel_sub" type="submit" value="" />
        	</form>
        </div>
        <div class="m_content">
        	<table class="qi_table" width="0" border="0" cellpadding="0" cellspacing="1">
              <tr><th >ID</th><th width="31%">题目名称</th><th width="7%">类别</th><th>属性</th><th width='7%'>题目类型</th><th>更新人</th><th>更新时间</th><th>操作</th></tr>
              <?php 
              	if(is_array($allquest)&&count($allquest)>0){
              		$i = 1+($page-1)*$pagesize;
//              		var_dump($allquest);
              		foreach ($allquest as $v) {     
              			foreach ($titCate as $val){
              				if($val['CID']===$v['CAT']){
              					$typename = $val['CN'];
              				}
              			}         	
              ?>
              <tr><td><?php echo $i++;?></td><td style="text-align:left"><?php echo str_replace($title, '<font style="color:red;"><B>'.$title.'</B></font>&nbsp;', $v['TITLE'])?></td><td><?php echo $typename;?></td><td><?php switch ($v['ATTR']) {
              	case 2:echo '系统题库';break;
              	
              	default:echo '用户题库';break;
              }?></td><td><?php switch ($v['QTYPE']){case 1:echo '单选题';break; case 2:echo '多选题';break; default:echo '填空题';break;}?></td><td><?php echo $v['UPD_USER']?></td>
              <td><?php echo $v['UPD_TIME']?></td>
              <td><a onclick="setback();" href="/index.php?c=quest&a=edit&id=<?php echo $v['Q_ID']?>">修改</a> 
              <?php if($v['QTYPE']<3){?>
              <a onclick="setback();" href="/index.php?c=questmanage&a=index&id=<?php echo $v['Q_ID']?>">选项管理</a> 
              <?php }?>
              <a href="/index.php?c=quest&a=del&id=<?php echo $v['Q_ID']?>" onclick='return delmod();'>删除</a></td></tr>
              <?php }}else{?>
              <tr><td colspan='10'>没有您查询的结果，请添加题目！</td></tr>
              <?php }?>
              <tr><td colspan='10'>
					<?php 
						$url = '/index.php?c=quest&a=index&p=_num_&ct='.$cattype.'&attr='.$attr.'&title='.urlencode($title);
						echo JYTools::pager($url,$totalNum,$page,$pagesize);
					?>
			  </td></tr>
            </table>
        </div>
    </div>
</body>
</html>
<script src="/js/xheditor/jquery/jquery-1.4.4.min.js" type="text/javascript"></script>
<script type='text/javascript'>
function goPage(){
	var url = '/index.php?c=quest&a=index&ct=<?php echo $cattype;?>&attr=<?php echo $attr;?>&title=<?php echo $title;?>&p='
	var go = document.getElementById('page')
	if(go.value!='' && go.value == parseInt(go.value)){
		url += go.value;
		document.location.href = url;
	}
};
function delmod(){
	if(confirm('确定要删除该分类吗？')){
		return true;
	}else{
		return false;
	}
}
function setback(){
	T.setCookie('goback_<?php echo $_REQUEST['c']?>','<?php echo $_SERVER['REQUEST_URI']?>')
}
</script>
<script src="/js/boot.js"></script>
<script src="/js/tip.js"></script>
<script src="/js/add_public_head.js" type="text/javascript"></script>